home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / uim / im-custom.scm < prev    next >
Encoding:
Text File  |  2010-11-07  |  16.1 KB  |  566 lines

  1. ;;; im-custom.scm: Customization variables for im.scm
  2. ;;;
  3. ;;; Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/
  4. ;;;
  5. ;;; All rights reserved.
  6. ;;;
  7. ;;; Redistribution and use in source and binary forms, with or without
  8. ;;; modification, are permitted provided that the following conditions
  9. ;;; are met:
  10. ;;; 1. Redistributions of source code must retain the above copyright
  11. ;;;    notice, this list of conditions and the following disclaimer.
  12. ;;; 2. Redistributions in binary form must reproduce the above copyright
  13. ;;;    notice, this list of conditions and the following disclaimer in the
  14. ;;;    documentation and/or other materials provided with the distribution.
  15. ;;; 3. Neither the name of authors nor the names of its contributors
  16. ;;;    may be used to endorse or promote products derived from this software
  17. ;;;    without specific prior written permission.
  18. ;;;
  19. ;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
  20. ;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. ;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. ;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
  23. ;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25. ;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26. ;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27. ;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28. ;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29. ;;; SUCH DAMAGE.
  30. ;;;;
  31.  
  32. (require "i18n.scm")
  33.  
  34. (define custom-im-list-as-choice-rec
  35.   (lambda (lst)
  36.      (filter-map (lambda (im)
  37.            (and im
  38.             (let ((sym (im-name im))
  39.                   (name-label (im-name-label im))
  40.                   (desc (im-short-desc im)))
  41.               (custom-choice-rec-new sym name-label desc))))
  42.          lst)))
  43.   
  44. (define-custom-group 'global
  45.              (N_ "Global settings")
  46.              (N_ "long description will be here."))
  47.  
  48. (define-custom-group 'toolbar
  49.              (N_ "Toolbar")
  50.              (N_ "long description will be here."))
  51.  
  52. ;; subgroup
  53. (define-custom-group 'advanced
  54.              (N_ "Advanced settings")
  55.              (N_ "long description will be here."))
  56.  
  57. ;; subgroup
  58. (define-custom-group 'buttons
  59.              (N_ "Buttons")
  60.              (N_ "long description will be here."))
  61.  
  62. ;; subgroup
  63. (define-custom-group 'menu-imsw
  64.              (N_ "Menu-based IM switcher")
  65.              (N_ "long description will be here."))
  66.  
  67. ;; subgroup
  68. (define-custom-group 'candwin
  69.              (N_ "Candidate window")
  70.              (N_ "long description will be here."))
  71.  
  72. ;; subgroup
  73. (define-custom-group 'annotation
  74.                      (N_ "Annotation")
  75.                      (N_ "long description will be here."))
  76.  
  77. ;; subgroup
  78. (define-custom-group 'dictionary
  79.                      (N_ "Dictionary")
  80.                      (N_ "long description will be here."))
  81.  
  82. ;; subgroup
  83. (define-custom-group 'segment-sep
  84.                      (N_ "Segment separator")
  85.                      (N_ "long description will be here."))
  86.  
  87. ;; subgroup
  88. (define-custom-group 'mode-transition
  89.                      (N_ "Mode transition")
  90.                      (N_ "long description will be here."))
  91.  
  92. ;; subgroup
  93. (define-custom-group 'special-op
  94.                      (N_ "Special operation")
  95.                      (N_ "long description will be here."))
  96.  
  97. ;; subgroup
  98. (define-custom-group 'default-im-name
  99.              (N_ "Default input method")
  100.              (N_ "long description will be here."))
  101.  
  102. ;; subgroup
  103. (define-custom-group 'im-deployment
  104.              (N_ "Input method deployment")
  105.              (N_ "long description will be here."))
  106.  
  107. ;; subgroup
  108. (define-custom-group 'visual-preference
  109.              (N_ "Visual preference")
  110.              (N_ "long description will be here."))
  111.  
  112. ;; 
  113. ;; default-im-name
  114. ;;
  115.  
  116. ;; warning: must be defined before custom-preserved-default-im-name
  117. (define-custom 'custom-activate-default-im-name? #f
  118.   '(global im-deployment)
  119.   '(boolean)
  120.   (N_ "Specify default IM")
  121.   (N_ "long description will be here."))
  122.  
  123. (define-custom 'custom-preserved-default-im-name
  124.   (and (not (null? im-list))
  125.        (im-name (find-default-im #f)))
  126.   '(global im-deployment)
  127.   (cons
  128.    'choice
  129.    (custom-im-list-as-choice-rec (reverse im-list)))
  130.   (N_ "Default input method")
  131.   (N_ "long description will be here."))
  132.  
  133. ;; activity dependency
  134. (custom-add-hook 'custom-preserved-default-im-name
  135.          'custom-activity-hooks
  136.          (lambda ()
  137.            custom-activate-default-im-name?))
  138.  
  139. (define custom-hook-get-default-im-name
  140.   (lambda ()
  141.     (set! custom-activate-default-im-name? default-im-name)
  142.     (set! custom-preserved-default-im-name (or default-im-name
  143.                            custom-preserved-default-im-name
  144.                            (im-name (find-default-im #f))))))
  145.  
  146. ;; decode #f from default-im-name
  147. (custom-add-hook 'custom-activate-default-im-name?
  148.          'custom-get-hooks
  149.          custom-hook-get-default-im-name)
  150. (custom-add-hook 'custom-preserved-default-im-name
  151.          'custom-get-hooks
  152.          custom-hook-get-default-im-name)
  153.  
  154. (define custom-hook-set-default-im-name
  155.   (lambda ()
  156.     (set! default-im-name
  157.       (and custom-activate-default-im-name?
  158.            custom-preserved-default-im-name))))
  159.  
  160. ;; encode #f into default-im-name
  161. (custom-add-hook 'custom-activate-default-im-name?
  162.          'custom-set-hooks
  163.          custom-hook-set-default-im-name)
  164. (custom-add-hook 'custom-preserved-default-im-name
  165.          'custom-set-hooks
  166.          custom-hook-set-default-im-name)
  167.  
  168. (define custom-hook-literalize-preserved-default-im-name
  169.   (lambda ()
  170.     (string-append
  171.      "(define custom-preserved-default-im-name "
  172.      (custom-value-as-literal 'custom-preserved-default-im-name)
  173.      ")\n"
  174.      "(define default-im-name "
  175.      (if default-im-name
  176.      (string-append "'" (symbol->string default-im-name))
  177.      "#f")
  178.      ")")))
  179.  
  180. (custom-add-hook 'custom-preserved-default-im-name
  181.          'custom-literalize-hooks
  182.          custom-hook-literalize-preserved-default-im-name)
  183.  
  184. ;;
  185. ;; Enabled IM list
  186. ;;
  187.  
  188. (define usable-im-list
  189.   (lambda ()
  190.     (let ((imlist (filter (lambda (name)
  191.                 (memq name installed-im-list))
  192.               enabled-im-list)))
  193.      (if (not (null? imlist))
  194.          imlist
  195.          '(direct)))))
  196.  
  197. (define-custom 'enabled-im-list (usable-im-list)
  198.   '(global im-deployment)
  199.   (cons
  200.    'ordered-list
  201.    (if custom-full-featured?
  202.        (custom-im-list-as-choice-rec (alist-delete 'direct stub-im-list))
  203.        ()))
  204.   (N_ "Enabled input methods")
  205.   (N_ "long description will be here."))
  206.  
  207. (custom-add-hook 'enabled-im-list
  208.          'custom-get-hooks
  209.          (lambda ()
  210.            (set! enabled-im-list (delete 'direct enabled-im-list))))
  211.  
  212. (define retrieve-im-for-custom-choice
  213.   (lambda (name)
  214.     (and name
  215.      (if (eq? name 'direct) ;; 'direct is not in the stub-im-list
  216.          (assq 'direct im-list)
  217.          (let ((im (assq name stub-im-list)))
  218.            im)))))
  219.  
  220. (define update-imsw-widget-of-context-widgets
  221.   (lambda ()
  222.     ;; update im-list
  223.     (for-each (lambda (stub)
  224.         (if (memq (stub-im-name stub) enabled-im-list)
  225.             (if enable-lazy-loading?
  226.             (apply register-stub-im stub)
  227.             (require-module (stub-im-module-name stub)))))
  228.           stub-im-list)
  229.     (set! im-list
  230.       (remove (lambda (im)
  231.         (and
  232.           (not (memq (im-name im) enabled-im-list))
  233.           (not (eq? (im-name im) 'direct))))
  234.           im-list))
  235.  
  236.     ;; update imsw widget
  237.     (if toolbar-show-action-based-switcher-button?
  238.     (let ((acts (imsw-actions)))
  239.       (register-widget 'widget_im_switcher
  240.                (activity-indicator-new acts)
  241.                (actions-new acts))
  242.       (for-each (lambda (ctx)
  243.               (let* ((widgets (context-widgets ctx))
  244.                  (widget-ids (map car widgets)))
  245.             (context-init-widgets! ctx widget-ids)))
  246.             context-list)))))
  247.  
  248. ;; value dependency
  249. (if custom-full-featured?
  250.     (custom-add-hook 'enabled-im-list
  251.              'custom-set-hooks
  252.              (lambda ()
  253.                (custom-set-type-info!
  254.             'custom-preserved-default-im-name
  255.             (cons 'choice
  256.                   (custom-im-list-as-choice-rec
  257.                    (map retrieve-im-for-custom-choice
  258.                         (if (not (memq 'direct enabled-im-list))
  259.                         (append enabled-im-list '(direct))
  260.                         enabled-im-list)))))
  261.                (custom-set-type-info!
  262.             'toggle-im-alt-im
  263.             (cons 'choice
  264.                   (custom-im-list-as-choice-rec
  265.                    (map retrieve-im-for-custom-choice
  266.                         (if (not (memq 'direct enabled-im-list))
  267.                         (append enabled-im-list '(direct))
  268.                         enabled-im-list)))))))
  269.     ;; for non- full-featured
  270.     (custom-add-hook 'enabled-im-list
  271.              'custom-set-hooks
  272.              update-imsw-widget-of-context-widgets))
  273.  
  274. ;;
  275. ;; im-switching
  276. ;;
  277. (define-custom-group 'im-switching
  278.   (N_ "Input method switching")
  279.   (N_ "long description will be here."))
  280.  
  281. (define-custom 'enable-im-switch? #f
  282.   '(global im-switching)
  283.   '(boolean)
  284.   (N_ "Enable IM switching by hotkey")
  285.   (N_ "long description will be here."))
  286.  
  287. (define-custom 'switch-im-key '("<Control>Shift_key" "<Shift>Control_key")
  288.   '(global im-switching)
  289.   '(key)
  290.   (N_ "IM switching key")
  291.   (N_ "long description will be here."))
  292.  
  293. (define-custom 'switch-im-skip-direct-im? #f
  294.   '(global im-switching)
  295.   '(boolean)
  296.   (N_ "Skip direct method for IM switching by hotkey")
  297.   (N_ "long description will be here."))
  298.  
  299. ;; activity dependency
  300. (custom-add-hook 'switch-im-key
  301.          'custom-activity-hooks
  302.          (lambda ()
  303.            enable-im-switch?))
  304.  
  305. (custom-add-hook 'switch-im-skip-direct-im?
  306.          'custom-activity-hooks
  307.          (lambda ()
  308.            enable-im-switch?))
  309.  
  310. ;; im-toggle 
  311. (define-custom-group 'im-toggle
  312.              (N_ "Input method toggle")
  313.              (N_ "long description will be here."))
  314.  
  315. (define-custom 'enable-im-toggle? #t
  316.   '(global im-toggle)
  317.   '(boolean)
  318.   (N_ "Enable input method toggle by hot keys")
  319.   (N_ "long description will be here."))
  320.  
  321. (define-custom 'toggle-im-key '("<Meta> ")
  322.   '(global im-toggle)
  323.   '(key)
  324.   (N_ "Input method toggle key")
  325.   (N_ "long description will be here."))
  326.  
  327. (define-custom 'toggle-im-alt-im 'direct
  328.   '(global im-toggle)
  329.   (cons
  330.    'choice
  331.    (if custom-full-featured?
  332.        (custom-im-list-as-choice-rec (reverse im-list))
  333.        ()))
  334.   (N_ "Alternative input method")
  335.   (N_ "long description will be here."))
  336.  
  337. (custom-add-hook 'toggle-im-alt-im
  338.          'custom-set-hooks
  339.          (lambda ()
  340.            (for-each (lambda (ctx)
  341.                    (reset-toggle-context! (context-id ctx) ctx))
  342.                  context-list)))
  343.  
  344.  
  345. ;; activity dependency
  346. (custom-add-hook 'toggle-im-key
  347.          'custom-activity-hooks
  348.          (lambda ()
  349.            enable-im-toggle?))
  350.  
  351. (custom-add-hook 'toggle-im-alt-im
  352.          'custom-activity-hooks
  353.          (lambda ()
  354.            enable-im-toggle?))
  355.  
  356.  
  357. (define-custom 'uim-color 'uim-color-uim
  358.   '(global visual-preference)
  359.   (list 'choice
  360.     (list 'uim-color-uim (N_ "uim") (N_ "uim native"))
  361.     (list 'uim-color-atok (N_ "ATOK like") (N_ "Similar to ATOK")))
  362.   (N_ "Preedit color")
  363.   (N_ "long description will be here."))
  364.  
  365. (custom-add-hook 'uim-color
  366.          'custom-set-hooks
  367.          (lambda ()
  368.            (update-style uim-color-spec (symbol-value uim-color))))
  369.  
  370. ;; referred by some bridges
  371. (define-custom 'candidate-window-position 'caret
  372.   '(global visual-preference)
  373.   (list 'choice
  374.     (list 'caret
  375.           (N_ "Adjacent to cursor")
  376.           (N_ "Adjacent to cursor"))
  377.     (list 'left
  378.           (N_ "Left end of preedit area")
  379.           (N_ "Left end of preedit area"))
  380.     (list 'right
  381.           (N_ "Right end of preedit area")
  382.           (N_ "Right end of preedit area")))
  383.   (N_ "Candidate window position")
  384.   (N_ "long description will be here."))
  385.  
  386. (define-custom 'enable-lazy-loading? #t
  387.   '(global advanced)
  388.   '(boolean)
  389.   (N_ "Enable lazy input method loading for fast startup")
  390.   (N_ "long description will be here."))
  391.  
  392. (custom-add-hook 'enable-lazy-loading?
  393.          'custom-set-hooks
  394.          (lambda ()
  395.            (if enable-lazy-loading?
  396.                (require "lazy-load.scm"))))
  397.  
  398. ;;
  399. ;; toolbar buttons
  400. ;;
  401.  
  402. (define imsw-reconfigure
  403.   (lambda ()
  404.     (if toolbar-show-action-based-switcher-button?
  405.     (require "im-switcher.scm"))
  406.     ;; Since context-list is empty on start-up, imsw-register-widget
  407.     ;; is not called here.
  408.     (if (and
  409.      (symbol-bound? 'context-refresh-switcher-widget!)
  410.      toolbar-show-action-based-switcher-button?)
  411.     (for-each context-refresh-switcher-widget!
  412.           context-list))))
  413.  
  414. ;; must be hooked before 'toolbar-show-action-based-switcher-button?
  415. ;; definition
  416. (custom-add-hook 'toolbar-show-action-based-switcher-button?
  417.          'custom-set-hooks
  418.          imsw-reconfigure)
  419.  
  420. (define-custom 'toolbar-show-action-based-switcher-button? #t
  421.   '(toolbar menu-imsw)
  422.   '(boolean)
  423.   (N_ "Enable menu-based input method switcher")
  424.   (N_ "Show menu-based IM switcher on toolbar."))
  425.  
  426. (define-custom 'imsw-coverage 'system-global
  427.   '(toolbar menu-imsw)
  428.   (list 'choice
  429.     (list 'system-global
  430.           (N_ "whole desktop")
  431.           (N_ "All input method of text areas on the system are changed."))
  432.     (list 'app-global
  433.           (N_ "focused application only")
  434.           (N_ "Only the input method of the focused application is changed. Other text areas remain untouched."))
  435.     (list 'focused-context
  436.           (N_ "focused text area only")
  437.           (N_ "Only the input method of the focused text area is changed. Other text areas remain untouched.")))
  438.   (N_ "Effective coverage")
  439.   (N_ "Specify where the IM switching takes effect."))
  440.  
  441. ;; activity dependency
  442. (custom-add-hook 'imsw-coverage
  443.          'custom-activity-hooks
  444.          (lambda ()
  445.            toolbar-show-action-based-switcher-button?))
  446.  
  447. (define-custom 'toolbar-show-switcher-button? #f
  448.   '(toolbar buttons)
  449.   '(boolean)
  450.   (N_ "full-featured input method switcher")
  451.   (N_ "Show the button on toolbar that invokes uim-im-switcher application for IM switching."))
  452.  
  453. (define-custom 'toolbar-show-pref-button? #t
  454.   '(toolbar buttons)
  455.   '(boolean)
  456.   (N_ "preference tool")
  457.   (N_ "long description will be here."))
  458.  
  459. (define-custom 'toolbar-show-dict-button? #f
  460.   '(toolbar buttons)
  461.   '(boolean)
  462.   (N_ "Japanese dictionary tool")
  463.   (N_ "long description will be here."))
  464.  
  465. (define-custom 'toolbar-show-input-pad-button? #f
  466.   '(toolbar buttons)
  467.   '(boolean)
  468.   (N_ "input pad")
  469.   (N_ "long description will be here."))
  470.  
  471. (define-custom 'toolbar-show-handwriting-input-pad-button? #f
  472.   '(toolbar buttons)
  473.   '(boolean)
  474.   (N_ "handwriting-input pad")
  475.   (N_ "long description will be here."))
  476.  
  477. (define-custom 'toolbar-show-help-button? #f
  478.   '(toolbar buttons)
  479.   '(boolean)
  480.   (N_ "help")
  481.   (N_ "long description will be here."))
  482.  
  483. (define-custom 'bridge-show-input-state? #f
  484.   '(global visual-preference)
  485.   '(boolean)
  486.   (N_ "Show input mode nearby cursor")
  487.   (N_ "long description will be here."))
  488.  
  489. (define-custom 'bridge-show-input-state-time-length 3
  490.   '(global visual-preference)
  491.   '(integer 0 100)
  492.   (N_ "Time length for showing input mode nearby the cursor")
  493.   (N_ "Set 0 to show indicator always."))
  494.  
  495. (custom-add-hook 'bridge-show-input-state-time-length
  496.          'custom-activity-hooks
  497.          (lambda ()
  498.            bridge-show-input-state?))
  499.  
  500. ;; EB Library support
  501. ;; 2005-02-08 Takuro Ashie <ashie@homa.ne.jp>
  502. ;; FIXME! Here isn't suitable position for EB support preference
  503. (define-custom-group 'eb
  504.              (N_ "EB library")
  505.              (N_ "long description will be here."))
  506.  
  507. (define-custom 'eb-enable-for-annotation? #f
  508.   '(eb candwin)
  509.   '(boolean)
  510.   (N_ "Use EB library to search annotations")
  511.   (N_ "long description will be here."))
  512.  
  513. (define-custom 'eb-dic-path
  514.   (string-append (sys-datadir) "/dict")
  515.   '(eb candwin)
  516.   '(pathname directory)
  517.   (N_ "The directory which contains EB dictionary file")
  518.   (N_ "long description will be here."))
  519.  
  520. (custom-add-hook 'eb-dic-path
  521.          'custom-activity-hooks
  522.          (lambda ()
  523.            eb-enable-for-annotation?))
  524.  
  525. ;; uim-xim specific custom
  526. (define-custom-group 'xim
  527.              (N_ "XIM")
  528.              (N_ "long description will be here."))
  529.  
  530. (define-custom-group 'preedit
  531.              (N_ "Preedit settings of XIM")
  532.              (N_ "long description will be here."))
  533.  
  534. (define-custom 'uim-xim-use-xft-font? #f
  535.   '(xim preedit)
  536.   '(boolean)
  537.   (N_ "Use anti-aliased fonts for Over-the-Spot/Root-Window preedit")
  538.   (N_ "long description will be here."))
  539.  
  540. (define-custom 'uim-xim-xft-font-name "Sans"
  541.   '(xim preedit)
  542.   '(string ".*")
  543.   (N_ "Font name for preedit area (anti-aliased)")
  544.   (N_ "long description will be here."))
  545.  
  546. (custom-add-hook 'uim-xim-xft-font-name
  547.          'custom-activity-hooks
  548.          (lambda ()
  549.            uim-xim-use-xft-font?))
  550.  
  551.  
  552. (define-custom-group 'notify
  553.              (N_ "Notify")
  554.              (N_ "long description will be here."))
  555.  
  556. (define-custom 'notify-agent 'stderr
  557.   '(notify)
  558.   `(choice
  559.     ,@(uim-notify-get-plugins))
  560.   (N_ "Notify agent name")
  561.   (N_ "long description will be here."))
  562.  
  563.  
  564. (if custom-full-featured?
  565.     (for-each require-module installed-im-module-list))
  566.